
import {PageModel} from "/@/api/system/model/CommonModel";
import axios from "/@/utils/http/axios";
import {MethodEnum} from "/@/utils/http/axios/enum/method-enum";
import {TemplateModel, TemplateQueryModel} from "/@/api/generator/model/TemplateModel";

/**
 * 新增模板
 * @param isHint
 * @param callBack
 */
export function insertTemplate(data: TemplateModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/generator/tool/template/insertTemplate", MethodEnum.POST, data, {callBack});
}

/**
 * 根据模板id修改模板
 * @param isHint
 * @param callBack
 */
export function updateTemplateByTemplateId(data: TemplateModel,callBack?: Function):Promise<void> {
    return axios.httpRequest("/generator/tool/template/updateTemplateByTemplateId", MethodEnum.POST, data, {callBack});
}
/**
 * 分页查询模板列表
 * @param isHint
 * @param callBack
 */
export function listTemplatePage(data: TemplateQueryModel,callBack?: Function):Promise<PageModel<TemplateModel[]>> {
    return axios.httpRequest("/generator/tool/template/listTemplatePage", MethodEnum.GET, data, {callBack});
}

/**
 * 查询模板列表
 * @param isHint
 * @param callBack
 */
export function listTemplate(data: TemplateQueryModel,callBack?: Function):Promise<TemplateModel[]> {
    return axios.httpRequest("/generator/tool/template/listTemplate", MethodEnum.GET, data, {callBack});
}
/**
 * 根据模板id查询模板
 * @param isHint
 * @param callBack
 */
export function selectTemplateByTemplateId(templateId: string,callBack?: Function):Promise<PageModel<TemplateModel[]>> {
    return axios.httpRequest("/generator/tool/template/selectTemplateByTemplateId", MethodEnum.GET, {templateId}, {callBack});
}

/**
 * 根据模板id删除模板
 * @param templateId
 * @param callBack
 */
export function deleteTemplateByTemplateId(templateId: string,callBack?: Function):Promise<PageModel<TemplateModel[]>> {
    return axios.httpRequest("/generator/tool/template/deleteTemplateByTemplateId", MethodEnum.GET, {templateId}, {callBack});
}